package main;

import java.util.List;

public class Util {
	
	public static double convertSecondsToMillis(double seconds) {
		return seconds * 1000;
	}
	
	public static double convertMillisToSeconds(double millis) {
		return millis / 1000;
	}

	public static double[] convertDoubleToArray(List<Double> doubles) {
		double[] array = new double[doubles.size()];
		for (int i = 0; i < doubles.size(); i++) {
			array[i] = doubles.get(i).doubleValue();
		}
		return array;
	}
	
	public static String prettyPrint(List<Double> doubles) {
		StringBuffer buffer = new StringBuffer();
		buffer.append("[");
		for (Double d : doubles) {
			buffer.append(prettyPrint(d) + "; ");
		}
		buffer.replace(buffer.length()-2, buffer.length(), "]");
		return buffer.toString();
	}

	public static String prettyPrint(Double d) {
		return String.format("%.4f",  d);
	}
}
